package com.sanxiau.dormitory.liu.dao;

import com.sanxiau.dormitory.liu.entity.Student;
import com.sanxiau.dormitory.liu.entity.Visitor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * 人员来访
 */
@Repository
public interface VisitorDao extends JpaRepository<Visitor, Object> {


    //更据学生id去查找
    @Transactional
    @Modifying
    @Query(nativeQuery = true, value = "select * from visitor where hou_id=:houId")
    List<Visitor> findByHouId(@Param("houId") String houId);



}
